/*
	Purpose: Using the sample of 1940 Census fathers aged 30-50
	         (from 0b), this file creates father income scores
	         at the occupation-only level. 

	Creates: avgincomes_fathers1940_byocc.dta
*/

clear
set more off
cd "$Mydirectory1/1_DataSources/CensusData/"

use ./input/Census1940_fathers_ages30to50_forIncomeScores.dta, clear 

*------------------------------------------------------------------------------------*
*------------------------------------------------------------------------------------*

*******************
*** COLLAPSE 
*******************

	gen number=1
	collapse (rawsum) number  (mean)  incwage fam_income hh_income , by(occ1950ej) 
	
* Count missings
	assert incwage!=.

*------------------------------------------------------------------------------------*
*------------------------------------------------------------------------------------*

**********
* Save
**********

	label var incwage "Coarse income score, incwage, by occ"
	label var hh_income "Coarse income score, household income, by occ"
	label var fam_income "Coarse income score, family income, by occ"
	
	label var number "Number of obs in 1940 occ cell"

	rename incwage avg_incwage_1940
	rename fam_income avg_faminc_1940
	rename hh_income avg_HHinc_1940
	
	rename occ1950ej fatheroccej
	rename number number_1940obs

	save ./output/avgincomes_fathers1940_byocc.dta, replace
